package com.examples.model;

import java.util.Map;

public class RestfulResponse {
    private String responseContent;

    private int status = -1;

    private Map<String, String> respHeaderMap = null;

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public Map<String, String> getRespHeaderMap() {
        return respHeaderMap;
    }

    public void setRespHeaderMap(Map<String, String> header) {
        respHeaderMap = header;
    }

    public int getRespHeaderInt(String key) {
        if (respHeaderMap != null) {
            String result = respHeaderMap.get(key);
            if (result != null) {
                return Integer.parseInt(result);
            }
        }

        return -1;
    }

    public long getRespHeaderLong(String key) {
        if (respHeaderMap != null) {
            String result = respHeaderMap.get(key);
            if (result != null) {
                return Long.parseLong(result);
            }
        }

        return -1L;
    }

    public String getRespHeaderStr(String key) {
        return respHeaderMap != null ? respHeaderMap.get(key) : null;
    }

    public String getResponseContent() {
        return responseContent;
    }

    public void setResponseJson(String responseString) {
        responseContent = responseString;
    }
}
